﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 依赖综合案例.ConfigServices
{
    internal class iniFileConfigServer : IConfigProjects
    {
        public string filePath { get; set; }

        public string GetValue(string name)
        {
            var maiMsg = File.ReadAllLines(filePath).Select(e => new
            {
                name = e.Split('=')[0],
                vale = e.Split("=")[1]
            }).Where(e => e.name == name).SingleOrDefault();
            if (maiMsg != null)
            {
                return maiMsg.vale;
            }
            else {
                return null;
            }
            
        }
    }
}
